﻿using Cmp.Web.Common;
using Cmp.Web.Repository;
using SqlSugar;

SqlSugarClient db = new SqlSugarClient(
    new ConnectionConfig()
    {
        ConnectionString = "server=127.0.0.1;database=MyCmpDB;uid=sa;pwd=123;Integrated Security=True;TrustServerCertificate=true;Trusted_Connection=False;",
DbType = DbType.SqlServer,//设置数据库类型
        IsAutoCloseConnection = true,//自动释放数据务，如果存在事务，在事务结束后释放
        InitKeyType = InitKeyType.Attribute //从实体特性中读取主键自增列信息
    });


//用来打印Sql方便你调试    
db.Aop.OnLogExecuting = (sql, pars) =>
{
    Console.WriteLine(sql + "\r\n" +
    db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
    Console.WriteLine();
};



db.DbFirst.Where(SqlSugar.DbObjectType.Table).CreateClassFile("C:\\Users\\13346\\source\\repos\\Cmp.Web.App\\Cmp.Web.Model", "Cmp.Web.Model");
Console.ReadKey();
       


